
package de.swta.freezay.user.orderPanel;

import de.swta.freezay.database.dbEntities.Reservation;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;

/**
 * The OderConfirmation displays the confirmation of an reservation.
 * It is used inside a modal window.
 *
 * @author Christian Baeumer
 */
public final class OrderConfirmation extends Panel {

    /**
     * Constructor
     *
     * @param id the markupID
     * @param r the reservation to confirm
     */
    public OrderConfirmation(String id, Reservation r) {

        super (id);

        /* add an simplified package view */
        add(new OrderPackageView("packageView", r.getPackage1()));
        /* set the package name in the confirmation text (see html file) */
        add(new Label("package", r.getPackage1().getName()));
        /* set the reservation nr in the confirmation text (see html file) */
        add(new Label("reservationNr", "" + r.getReservationNr()));
        /* add a window closing link */
        add(new Link("close") {
            // <editor-fold defaultstate="collapsed" desc="closing behaviour">
            @Override
            public void onClick() {
                /* nothing to do here */
            }
            // </editor-fold>
        });
    }

}
